package com.x.erp.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.x.erp.model.Series;
import com.x.erp.rpc.SeriesRpcService;
import com.x.framework.controller.BaseController;
import com.x.framework.controller.ResultCode;
import com.x.framework.controller.ResultModel;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 车系Controlle Created by gdf on 2018/1/26.
 */
@RestController
public class SeriesController extends BaseController {

	@Reference
	private SeriesRpcService seriesRpcService;// 车系服务

	/**
	 * 查询车系列表
	 * 
	 * @param series
	 * @return
	 */
	@RequestMapping(value = "/getSeriesList", method = { RequestMethod.POST, RequestMethod.GET })
	public ResultModel getSeriesList(Series series) {
		if(series == null){
			return new ResultModel(ResultCode.RESULT_FAIL, "品牌ID信息不能为空！");
		}
		if (series.getBrandId() == null) {
			return new ResultModel(ResultCode.RESULT_FAIL, "品牌ID不能为空！");
		}
		return new ResultModel(ResultCode.RESULT_SUCCESS, "查询成功", seriesRpcService.selectSeriesList(series));
	}
}
